package javabase.schoolwork.day6_11;

import java.util.ArrayList;
import java.util.List;

/**
 * @author fance
 * @date 18-6-11 下午6:14
 */
public class Driver {
    private List<Car>  cars = new ArrayList<>();

    public Driver() {
    }

    public Driver(Car car) {
        this.cars .add(car);
    }
    public void driver(Car car) {
        for (Car car1 : cars) {
            if (car1.getBrand().equals(car.getBrand())) {
                car.run();
                break;
            }
        }
    }
    public void driver() {
        for (Car car1 : cars) {

            car1.run();


        }
    }

    public List<Car> getCars() {
        return cars;
    }


    public void setCar(Car car) {

        cars.add(car);
    }
}
